package dao.aplicacao;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;


import modelos.aplicacao.MarcasModel;
import dao.BaseDao;

public class MarcasDao extends BaseDao {
	
	public ArrayList<MarcasModel>  getMarcas() throws SQLException{
		
		
		ArrayList<MarcasModel> marcas = new ArrayList<MarcasModel>();
		
		String sql = "SELECT * FROM `marca` ";
		
		PreparedStatement ps = con.prepareStatement(sql);
		
		ResultSet result =  ps.executeQuery();
		
		while(result.next()){
			
			MarcasModel marca = new MarcasModel();
			
			marca.setId(result.getInt("id"));
			marca.setNome(result.getString("nome"));
			marca.setImagem(result.getString("imagem"));
			
			marcas.add(marca);
			
		}
		
		return marcas;
	}
	
}
